package com.scy.java.object.StringDemo;
//用户名密码校验
import java.util.Scanner;

public class LoginString {


    public static void main(String[] args) {
        //系统用户名密码
        String userName =  "admin";
        String passWord =  "111111";
        Scanner s = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            //键盘录入
            System.out.println("请输入用户名：");
            String sUser = s.next();
            System.out.println("请输入密码：");
            String sPwd = s.next();

            if (sUser.equals(userName)  && sPwd.equals(passWord)) {
                System.out.println("欢迎光临！");
                break;
            } else {
                if ( i==0){
                    System.out.println("账号："+userName+"已被锁定");
                }else {
                    System.out.println("您输入的密码或者用户名错误！");
                    System.out.println("您还有"+(3-i-1)+"次机会");
                }

            }


        }

    }

}
